﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


using System.Collections;
using System.Data.OleDb;

namespace newTurtle8
{
    public partial class QueryPrintForm : Form
    {
        public bool IsOk { get; set; }
        public string printerName = string.Empty;
        public string PrintTitle
        { get { return textBoxTitle.Text; } }

        public QueryPrintForm(List<string> availableFields)
        {
            InitializeComponent();

            foreach (string field in availableFields)
                checkedListBox.Items.Add(field, true);

            IsOk = true;
        }

        public List<string> GetSelectedColumns()
        {
            List<string> lst = new List<string>();
            foreach (object item in checkedListBox.CheckedItems)
                lst.Add(item.ToString());
            return lst;
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
            if (printDialog.ShowDialog() != DialogResult.OK)
                IsOk = false;
            printerName = printDialog.PrinterSettings.PrinterName;
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
